<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:x="http://myfaces.apache.org/extensions"
	template="template.xhtml">

  <ui:define name="content">
    <h:outputText value="New Item" styleClass="titles"></h:outputText>
    <br/>
	<h:form>
		<h:panelGrid columns="3">
			<h:outputLabel for="name" value="Title" styleClass="labels"/>
			 <h:inputText id="name" value="#{newItem.item.name}" required="true" styleClass="textfields" size="44"/>
			<h:message for="name" styleClass="errors"/>
			
			<h:outputLabel for="description" value="Description" styleClass="labels"/>
			  <h:inputTextarea id="description" value="#{newItem.item.description}" 
				required="true" styleClass="textfields" cols="40" rows="10"/>
			<h:message for="description" styleClass="errors"/>
			
			<h:outputLabel for="category" value="Category" styleClass="labels"/>
			 <h:selectOneMenu id="category" value="#{newItem.item.category}" required="true" styleClass="textfields">
            	<f:selectItems value="#{newItem.item.allCategories}"/>
        	 </h:selectOneMenu>
        	<h:message for="category" styleClass="errors"/>
        	
        	<h:outputLabel for="vendor" value="Vendor" styleClass="labels"/>
			 <h:selectOneMenu id="vendor" value="#{newItem.item.vendor}" required="true" styleClass="textfields">
            	<f:selectItems value="#{newItem.item.allVendors}"/>
        	 </h:selectOneMenu>
        	<h:message for="vendor" styleClass="errors"/>
			
			<h:outputLabel for="price" value="Price" styleClass="labels"/>
			 <h:inputText id="price" value="#{newItem.item.price}" required="true" styleClass="textfields"/>
			<h:message for="price" styleClass="errors"/>
			
			<h:outputLabel for="image" value="Image" styleClass="labels"/>
			  <x:inputFileUpload id="image" value="#{newItem.image}" storage="file" required="true"/>
            <h:message for="image" styleClass="errors"/>
		</h:panelGrid>
		<h:commandButton value="Save" action="#{newItem.save}" styleClass="buttons" />
	</h:form>
  </ui:define>
  
</ui:composition>